#ifndef SDLWINDOW_H
#define SDLWINDOW_H

#include <SDL/SDL.h>
#include <auto_ptr.h>

#include "tankmodel.h"
#include "terrain.h"

class SDLWindow
{
public:
    SDLWindow();
    ~SDLWindow();

    int exec();

protected:
    void render();
    void processCameraEvent(SDL_Event& event);
    void processPlayerEvent(SDL_Event& event);
    void setProjection();

private:
    SDL_Surface* surface_;

    Terrain terrain_;
    Player player_;
    Opponent opponent_;
    std::auto_ptr<Projectile> projectile_;

    static const double sceneWidth_;
    static const double sceneHeight_;

    mutable int winWidth_, winHeight_;
    mutable double scaleFactorX_, scaleFactorY_;
    mutable double cameraPosX_, cameraPosY_;
    mutable double maxZoomOutFactorX_, maxZoomOutFactorY_;

    static const double zoomStep_  = 1.25;
    static const double cameraMoveStep_  = 5.0;
};

#endif // SDLWINDOW_H
